#pragma once


// PropertiesDlg dialog

#include <utility/EventHandler.h>
#include <vector>

namespace serika
{
	namespace dq
	{
		class PropertyPage;
		class PropertyTemplate;
		class EditItemPanel;

		class PropertiesDlg : public CDialog, public ut::EventHandler
		{
			DECLARE_DYNAMIC(PropertiesDlg)

		public:
			PropertiesDlg(CWnd* pParent = NULL);   // standard constructor
			virtual ~PropertiesDlg();

			// Dialog Data
			enum { IDD = IDD_PROPERTIESDLG };

			static void Show(CWnd* wnd);
			static void Hide();
			static void Destroy();

		public:
			virtual void Handle(const ut::Event& e);

			void Activate();
			void Deactivate();

		protected:
			virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

			virtual BOOL OnInitDialog();
			DECLARE_MESSAGE_MAP()
			afx_msg void OnListChanged();
			afx_msg void OnDestroy();
			afx_msg void OnAddBtnClicked();

		private:
			void OnPropertyTemplates(const ut::Event& e);

		private:
			CListBox mList;

			typedef std::vector<PropertyPage*> Pages;
			Pages mPages;
			PropertyPage* mActivePage;

			static bool sClose;

			void ClearPages();
			void CreatePage(PropertyTemplate* tmpl);

			static PropertiesDlg*& Instance();
		};
	}
}
